﻿Imports org.codegen.win.controls.Grid

Namespace Forms.List
    <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
    Public Class frmCertificationEarnedList
        Inherits frmBaseGrid

#Region "Designer"

        'Form overrides dispose to clean up the component list.
        <System.Diagnostics.DebuggerNonUserCode()> _
        Protected Overrides Sub Dispose(ByVal disposing As Boolean)
            Try
                If disposing AndAlso components IsNot Nothing Then
                    components.Dispose()
                End If
            Finally
                MyBase.Dispose(disposing)
            End Try
        End Sub

        Friend WithEvents ucCertificationEarnedList As ucCertificationEarnedList

        'Required by the Windows Form Designer
        Private components As System.ComponentModel.IContainer

        'NOTE: The following procedure is required by the Windows Form Designer
        'It can be modified using the Windows Form Designer.  
        'Do not modify it using the code editor.
        <System.Diagnostics.DebuggerStepThrough()> _
        Private Sub InitializeComponent()
            Me.ucCertificationEarnedList = New IIC.ucCertificationEarnedList()
            Me.pnlGrid.SuspendLayout()
            Me.SuspendLayout()
            '
            'pnlGrid
            '
            Me.pnlGrid.Controls.Add(Me.ucCertificationEarnedList)
            Me.pnlGrid.Location = New System.Drawing.Point(0, 53)
            Me.pnlGrid.Size = New System.Drawing.Size(760, 389)
            '
            'ucCertificationEarnedList
            '
            Me.ucCertificationEarnedList.Dock = System.Windows.Forms.DockStyle.Fill
            Me.ucCertificationEarnedList.Location = New System.Drawing.Point(0, 0)
            Me.ucCertificationEarnedList.Name = "ucCertificationEarnedList"
            Me.ucCertificationEarnedList.Size = New System.Drawing.Size(760, 389)
            Me.ucCertificationEarnedList.TabIndex = 0
            '
            'frmCertificationEarnedList
            '
            Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
            Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
            Me.ClientSize = New System.Drawing.Size(760, 442)
            Me.Name = "frmCertificationEarnedList"
            Me.ShowConfigButton = True
            Me.ShowExcelButton = True
            Me.ShowPrintButton = True
            Me.ShowSearch = True
            Me.Text = "Certification Earned List"
            Me.Controls.SetChildIndex(Me.pnlGrid, 0)
            Me.pnlGrid.ResumeLayout(False)
            Me.ResumeLayout(False)

        End Sub

#End Region

#Region "Standard Code"

        Private Sub frmCertificationEarnedList_Load(ByVal sender As Object, ByVal e As System.EventArgs) _
           Handles Me.Load

            Me.addToolbarActionButton("Lessons", AddressOf openCauses)
        End Sub

        ''' <summary>
        ''' This function is common to all forms that inherit from class frmBaseGrid
        ''' It priovides a common name to the underlying grid control that shows the records
        ''' </summary>
        Public Overrides Function grdData() As org.codegen.win.controls.Grid.CGBaseGrid
            Return Me.ucCertificationEarnedList.grdCertificationEarned
        End Function

        Protected Sub DeleteRecordConfirmed(ByVal sender As System.Object) Handles Me.gridDeleteRecordConfirmed

            Dim m As New CertificationEarnedDBMapper
            Dim gridsender As CGBaseGrid = CType(sender, CGBaseGrid)

            Dim mo As ModelObject = m.findByKey(gridsender.IdValue)
            Call m.delete(mo)

        End Sub

#End Region

#Region "custom code"

        Public Sub setFilterCertificationTypeId(ByVal value As Integer?, ByVal certname As String)

            Me.ucCertificationEarnedList.CertificationTypeId.Visible = False
            CType(Me.grdData, Grid.CGSQLGrid).gpWhereclause = "CertificationTypeId=" & CStr(value.GetValueOrDefault)
            Me.Text = "Student List that Earned Certificate " & certname

        End Sub


#End Region

        Private Sub openCauses(ByVal sender As Object, ByVal e As System.EventArgs)
            'opens the frmCertificationEarnedLessonsList to show the causes that earned this certificate
            If Me.grdData.SelectedRows.Count = 0 Then Exit Sub

            Using f As New frmCertificationEarnedLessonsList

                f.loadCertificateEarnedHistory(Me.grdData)
                f.ShowDialog()

            End Using

        End Sub

    End Class

End Namespace

